package com.commom.api;

import com.commom.entity.User;
import com.commom.utils.APIUtils;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.HashMap;
import java.util.Map;

/**
 * Created by _Mumu on 15/7/28.
 */

@Controller
@RequestMapping("/")
public class APIController {

    @RequestMapping("/login")
    public @ResponseBody Object login(@RequestBody User user) {

        Map<String, Object> apiResult = new HashMap<String, Object>();

        if (user.getUserName().equalsIgnoreCase("zhanglaosan") && user.getPassWord().equals("zls123")) {
            apiResult.put("loginUser", user);
            APIUtils.Success(apiResult);
        } else {
            APIUtils.Faild(apiResult);
        }

        return apiResult;
    }

}
